const path = require('path');
let HtmlWebpackPlugin = require('html-webpack-plugin');
let VueLoaderPlugin = require('vue-loader/lib/plugin')
module.exports = {
    //入口
    entry: './src/main.js',
    //出口
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js',
    },
    //设置别名
    resolve: {
        alias: {
         '@components': path.resolve(__dirname, 'src/components'),
         '@s': path.resolve(__dirname, 'src')
        }
      },
    module: {
        rules: [
            { test: /\.css/, use: ['vue-style-loader', 'css-loader'] },
            {
                test: /\.js/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env']
                    },
                },
                exclude: /node_modules/,
            },
            { test: /\.vue/, use: 'vue-loader' }
        ]
    },
    plugins: [
        new VueLoaderPlugin(),
        new HtmlWebpackPlugin({
            filename:'index.html',
            template: './src/index.html'
        })
    ]
};